import pygame

class Controls():
    #def __init__(self,up,down,left,right,button1,button2):
    def __init__(self,keys):
        self.up=     self.resolve_keyref(keys['up'])
        self.down=   self.resolve_keyref(keys['down'])
        self.left=   self.resolve_keyref(keys['left'])
        self.right=  self.resolve_keyref(keys['right'])
        self.__hoof= self.resolve_keyref(keys['hoof'])
        self.__pass= self.resolve_keyref(keys['pass'])
        
    def to_ordered_pair_of_lists(self):
        return [ [ 'Up', 'Down', 'Left', 'Right', 'Hoof', 'Pass' ] , 
             [ pygame.key.name(self.up),
              pygame.key.name(self.down),
              pygame.key.name(self.left),
              pygame.key.name(self.right),
              pygame.key.name(self.__hoof),
              pygame.key.name(self.__pass) ] ]
    
    #yay
    def resolve_keyref(self,keyref):
        if len(keyref) > 1:
            return int(keyref)
        else:
            return ord(keyref)
        
    def get_hoof(self):
        return self.__hoof
        
    def get_pass(self):
        return self.__pass